package work5;
import java.io.File;

public class Demo {
    public static void main(String[] args) {
        File srcDir = new File("E:\\source_files");
        File destDir = new File("E:\\target_files");

        if (!srcDir.exists() || !srcDir.isDirectory()) {
            System.out.println("文件夹不存在或不是目录！");
            return;
        }

        if (!destDir.exists()) {
            destDir.mkdirs();
        }
        File[] files = srcDir.listFiles();
        if (files != null) {
            for (File srcFile : files) {
                if (srcFile.isFile()) {
                    File destFile = new File(destDir, srcFile.getName());
                    Thread t = new Thread(new Copy(srcFile, destFile));
                    t.start();
                }
            }
        }
        if(files == null || files.length == 0) {
                System.out.println("源目录为空！");
        }
    }
}

